home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 July / Macworld (1999-07).dmg / Shareware World / Graphics / Popup Xtra 3.2 / popdemo.dir / 00004_Script_Menubar behavior < prev    next >
Text File  |  1999-04-10  |  2KB  |  79 lines

  1. -- Menubar behavior
  2. --
  3. -- Function
  4. --
  5. -- Simulates a menu bar by making a popup menu appear under
  6. -- a transparent sprite placed over the menu word in a
  7. -- menu bar graphic.
  8. --
  9. -- Usage
  10. --
  11. -- Apply to transparent sprite placed over menu word
  12. --
  13. -- Properties
  14. --
  15. -- mySprite:  sprite number of highlight sprite behavior
  16. --            is attached to
  17. -- verticalOffset: pixels from top of highlight sprite
  18. --            to position popup menu
  19. -- normalInk: ink type for normal state of highlight
  20. --            sprite, probably background transparent
  21. -- hiliteInk: ink type for highlight state of highlight
  22. --            sprite, probably reverse
  23. -- myMenu:    name of Popup Xtra member to display
  24. -- imHilited: TRUE if highlight sprite is currently highlighted
  25. --
  26.  
  27. property mySprite,verticalOffset,normalInk,hiliteInk
  28. property myMenu,imHilited
  29.  
  30. on beginSprite me
  31.   set mySprite = the spriteNum of me
  32.   set imHilited = FALSE
  33. end
  34.  
  35. on mouseDown me
  36.   set the ink of sprite mySprite = hiliteInk
  37.   updateStage
  38.   sendAllSprites(#unhilite)
  39.   set imHilited = TRUE
  40.   set horPos = the left of sprite mySprite + 1
  41.   set vertPos = the top of sprite mySprite + verticalOffset
  42.   activate(member myMenu,horPos,vertPos)
  43. end
  44.  
  45. on unhilite me
  46.   set the ink of sprite mySprite = normalInk
  47. end
  48.  
  49. on exitFrame me
  50.   if not the stillDown and imHilited = TRUE then
  51.     unhilite me
  52.   end if
  53. end
  54.  
  55. on getPropertyDescriptionList  
  56.   set p_list = [:]
  57.   set oneParam = [:]
  58.   addProp oneParam,#comment,"Offset in pixels from top of trigger sprite"
  59.   addProp oneParam,#format,#integer
  60.   addProp oneParam,#default,23
  61.   addProp p_list,#verticalOffset,duplicate(oneParam)
  62.   set oneParam = [:]
  63.   addProp oneParam,#comment,"Ink number of menu hilite ink"
  64.   addProp oneParam,#format,#integer
  65.   addProp oneParam,#default,2
  66.   addProp p_list,#hiliteInk,duplicate(oneParam)
  67.   set oneParam = [:]
  68.   addProp oneParam,#comment,"Ink number of menu normal state ink"
  69.   addProp oneParam,#format,#integer
  70.   addProp oneParam,#default,36
  71.   addProp p_list,#normalInk,duplicate(oneParam)
  72.   set oneParam = [:]
  73.   addProp oneParam,#comment,"Name of popup member to trigger"
  74.   addProp oneParam,#format,#string
  75.   addProp oneParam,#default,"popup"
  76.   addProp p_list,#myMenu,duplicate(oneParam)
  77.   return p_list 
  78. end
  79.